package com.xs.store.user.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.xs.store.user.mapper.UserMapper;
import com.xs.store.user.pojo.User;
import com.xs.store.user.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserServiceImpl implements UserService {

    @Autowired
    UserMapper userMapper;

    @Override
    public String login(User user) {
        QueryWrapper<User> ew = new QueryWrapper<>();
        ew.eq("account_name",user.getAccountName()).eq("password",user.getPassword());
        User user1= userMapper.selectOne(ew);
        return user1.toString();
    }

    @Override
    public List<User> list() {
        QueryWrapper<User> ew = new QueryWrapper<>();
        return userMapper.selectList(ew);
    }
}
